﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Converters="clr-namespace:DTC.Converters">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Brushes.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    <Storyboard x:Key="BackGlowEnter">
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
            <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimation
                                        Storyboard.TargetName="OGlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="0" To="2" Duration="00:00:00.3000000" />
    </Storyboard>
    <Storyboard x:Key="BackGlowExit">
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
            <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimation
                                        Storyboard.TargetName="OGlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="2" To="0" Duration="00:00:00.3000000" />
    </Storyboard>
    <Storyboard x:Key="GlowEnter">
        <DoubleAnimation
                                        Storyboard.TargetName="GlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="0" To="3" Duration="00:00:00.3000000" />
    </Storyboard>
    <Storyboard x:Key="GlowExit">
        <DoubleAnimation
                                        Storyboard.TargetName="GlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="3" To="0" Duration="00:00:00.3000000" />
    </Storyboard>
    
    <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBoxBase}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
       	<Setter Property="Background" Value="{StaticResource DefaultControlBackground}"/>
		<Setter Property="BorderBrush" Value="#FF4C4C4C"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="MinWidth" Value="30"/>
        <Setter Property="MinHeight" Value="17"/>
        <Setter Property="Height" Value="19"/>
        <Setter Property="AllowDrop" Value="true"/>
		<Setter Property="FontSize" Value="12"/>
		<Setter Property="BorderThickness" Value="0,0,0,1"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBoxBase}">
                    <Border CornerRadius="2"
							SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
							BorderThickness="0">
                        <Border.BitmapEffect>
                            <OuterGlowBitmapEffect x:Name="OGlowEfx"
                                    GlowColor="#FF555555" GlowSize="0"/>
                        </Border.BitmapEffect>
                        <Border Name="OBorder"
                                CornerRadius="2"
								Margin="-1" 
                                Background="Transparent"                        
                                BorderThickness="{TemplateBinding BorderThickness}" 
								SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                BorderBrush="{TemplateBinding BorderBrush}">
                            <Border.BitmapEffect>
                                <OuterGlowBitmapEffect x:Name="GlowEfx"
                                    GlowColor="#FF777777" GlowSize="0"/>
                            </Border.BitmapEffect>
                            <Grid SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                <Border Opacity="1" 
										HorizontalAlignment="Stretch" 
										x:Name="background"
										CornerRadius="2"
										Background="{TemplateBinding Background}"
										SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
										BorderThickness="0"/>
                                <Border Opacity="0" 
										HorizontalAlignment="Stretch" 
										x:Name="glow" 
										Width="Auto" 
										CornerRadius="2"
										BorderThickness="0"
										SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                    <Border.Background>
                                        <RadialGradientBrush>
                                            <RadialGradientBrush.RelativeTransform>
                                                <TransformGroup>
                                                    <ScaleTransform ScaleX="6" ScaleY="4"/>
                                                    <SkewTransform AngleX="0" AngleY="0"/>
                                                    <RotateTransform Angle="0"/>
                                                    <TranslateTransform X="-2.5" Y="-1"/>
                                                </TransformGroup>
                                            </RadialGradientBrush.RelativeTransform>
                                            <GradientStop Color="#AA5588FF" Offset="1"/>
                                            <GradientStop Color="#225588FF" Offset="0"/>
                                        </RadialGradientBrush>
                                    </Border.Background>
                                </Border>
                                <ScrollViewer Margin="2,2,2,1"
											x:Name="PART_ContentHost"
											FontSize="{TemplateBinding FontSize}"
											VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
											SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Grid>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsFocused" Value="False"/>
                                <Condition Property="IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource GlowEnter}"/>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource GlowExit}"/>
                            </MultiTrigger.ExitActions>                            
                        </MultiTrigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource BackGlowEnter}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource BackGlowExit}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter Property="ToolTip"
                                    Value="{Binding RelativeSource={RelativeSource Self},
                                            Path=(Validation.Errors)[0].ErrorContent}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel LastChildFill="True">
                        <TextBlock DockPanel.Dock="Right" Foreground="Red"
                                   FontSize="14"
                                   VerticalAlignment="Top"
                                   Margin="3,0,0,0"
                                   Text="*"/>
                        <Border BorderBrush="Red" BorderThickness="0,0,0,1">
                            <AdornedElementPlaceholder Name="adornerPlaceholder">
                            </AdornedElementPlaceholder>
                        </Border>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
	 <Style x:Key="HighlightedTextBoxStyle" TargetType="{x:Type TextBoxBase}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
       	<Setter Property="Background" Value="{StaticResource DefaultControlBackground}"/>
		<Setter Property="BorderBrush" Value="#FF4C4C4C"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="MinWidth" Value="30"/>
        <Setter Property="MinHeight" Value="17"/>
        <Setter Property="Height" Value="19"/>
        <Setter Property="AllowDrop" Value="true"/>
		<Setter Property="FontSize" Value="12"/>
		<Setter Property="BorderThickness" Value="0,0,0,1"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBoxBase}">
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="10"/>
					</Grid.ColumnDefinitions>
                    <Border CornerRadius="2"
							SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
							BorderThickness="0">
                        <Border.BitmapEffect>
                            <OuterGlowBitmapEffect x:Name="OGlowEfx"
                                    GlowColor="#FF555555" GlowSize="0"/>
                        </Border.BitmapEffect>
                        <Border Name="OBorder"
                                CornerRadius="2"
								Margin="-1" 
                                Background="Transparent"                        
                                BorderThickness="{TemplateBinding BorderThickness}" 
								SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                BorderBrush="{TemplateBinding BorderBrush}">
                            <Border.BitmapEffect>
                                <OuterGlowBitmapEffect x:Name="GlowEfx"
                                    GlowColor="#FF777777" GlowSize="0"/>
                            </Border.BitmapEffect>
                            <Grid SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                <Border Opacity="1" 
										HorizontalAlignment="Stretch" 
										x:Name="background"
										CornerRadius="2"
										Background="{TemplateBinding Background}"
										SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
										BorderThickness="0"/>
                                <Border Opacity="0" 
										HorizontalAlignment="Stretch" 
										x:Name="glow" 
										Width="Auto" 
										CornerRadius="2"
										BorderThickness="0"
										SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                    <Border.Background>
                                        <RadialGradientBrush>
                                            <RadialGradientBrush.RelativeTransform>
                                                <TransformGroup>
                                                    <ScaleTransform ScaleX="6" ScaleY="4"/>
                                                    <SkewTransform AngleX="0" AngleY="0"/>
                                                    <RotateTransform Angle="0"/>
                                                    <TranslateTransform X="-2.5" Y="-1"/>
                                                </TransformGroup>
                                            </RadialGradientBrush.RelativeTransform>
                                            <GradientStop Color="#AA5588FF" Offset="1"/>
                                            <GradientStop Color="#225588FF" Offset="0"/>
                                        </RadialGradientBrush>
                                    </Border.Background>
                                </Border>
                                <ScrollViewer Margin="2,2,2,1"
											x:Name="PART_ContentHost"
											FontSize="{TemplateBinding FontSize}"
											VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
											SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Grid>
                        </Border>
                    </Border>
					<TextBlock VerticalAlignment="Top"
								Margin="3,0,0,0"
								FontSize="14"
								Text="*"
								Foreground="Red"
								Grid.Column="1"
								Name="Asterix"
								Visibility="Hidden"/>
					</Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsFocused" Value="False"/>
                                <Condition Property="IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource GlowEnter}"/>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource GlowExit}"/>
                            </MultiTrigger.ExitActions>                            
                        </MultiTrigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource BackGlowEnter}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource BackGlowExit}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter Property="ToolTip"
                                    Value="{Binding RelativeSource={RelativeSource Self},
                                            Path=(Validation.Errors)[0].ErrorContent}"/>
						</Trigger>
						<Trigger Property="TextBox.Text" Value="">
							<Setter TargetName="Asterix" Property="Visibility" Value="Visible"/>
							<Setter TargetName="OBorder" Property="BorderBrush" Value="Red"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel LastChildFill="True">
                        <TextBlock DockPanel.Dock="Right" Foreground="Red"
                                   FontSize="14"
                                   VerticalAlignment="Top"
                                   Margin="3,0,0,0"
                                   Text="*"/>
                        <Border BorderBrush="Red" BorderThickness="0,0,0,1">
                            <AdornedElementPlaceholder Name="adornerPlaceholder">
                            </AdornedElementPlaceholder>
                        </Border>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
	
    <Style x:Key="{x:Type Converters:MaskedTextBox}" TargetType="{x:Type Converters:MaskedTextBox}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Background" Value="{StaticResource DefaultControlBackground}"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="MinWidth" Value="30"/>
        <Setter Property="MinHeight" Value="17"/>
        <Setter Property="Height" Value="17"/>
        <Setter Property="AllowDrop" Value="true"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Converters:MaskedTextBox}">
                    <Border CornerRadius="2">
                        <Border.BitmapEffect>
                            <OuterGlowBitmapEffect x:Name="OGlowEfx"
                                    GlowColor="#FF555555" GlowSize="0"/>
                        </Border.BitmapEffect>
                        <Border Name="OBorder"
                                CornerRadius="2" 
                                Background="Transparent"                        
                                BorderThickness="0,0,0,1" 
                                BorderBrush="Gray" Margin="-1">
                            <Border.BitmapEffect>
                                <OuterGlowBitmapEffect x:Name="GlowEfx"
                                    GlowColor="#FF777777" GlowSize="0"/>
                            </Border.BitmapEffect>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="0.507*"/>
                                    <RowDefinition Height="0.493*"/>
                                </Grid.RowDefinitions>
                                <Border Opacity="1" HorizontalAlignment="Stretch" x:Name="background" Width="Auto" CornerRadius="2" Grid.RowSpan="2" Background="{TemplateBinding Background}"/>
                                <Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" CornerRadius="2" Grid.RowSpan="2">
                                    <Border.Background>
                                        <RadialGradientBrush>
                                            <RadialGradientBrush.RelativeTransform>
                                                <TransformGroup>
                                                    <ScaleTransform ScaleX="6" ScaleY="4"/>
                                                    <SkewTransform AngleX="0" AngleY="0"/>
                                                    <RotateTransform Angle="0"/>
                                                    <TranslateTransform X="-2.5" Y="-1"/>
                                                </TransformGroup>
                                            </RadialGradientBrush.RelativeTransform>
                                            <GradientStop Color="#AA5588FF" Offset="1"/>
                                            <GradientStop Color="#225588FF" Offset="0"/>
                                        </RadialGradientBrush>
                                    </Border.Background>
                                </Border>
                                <ScrollViewer Margin="2,2,2,1" x:Name="PART_ContentHost" Grid.RowSpan="2"/>
                            </Grid>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsFocused" Value="False"/>
                                <Condition Property="IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource GlowEnter}"/>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource GlowExit}"/>
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource BackGlowEnter}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource BackGlowExit}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
	
	<Style x:Key="SearchTextBoxStyle" TargetType="{x:Type TextBoxBase}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
       	<Setter Property="Background" Value="White"/>
		<Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="MinWidth" Value="30"/>
        <Setter Property="MinHeight" Value="17"/>
        <Setter Property="Height" Value="21"/>
        <Setter Property="AllowDrop" Value="true"/>
		<Setter Property="FontSize" Value="11"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBoxBase}">
                    <Border CornerRadius="2"
							SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
							BorderThickness="{TemplateBinding BorderThickness}"
							Background="{TemplateBinding Background}"
							BorderBrush="{TemplateBinding BorderBrush}"
							Height="{TemplateBinding Height}">
                                <ScrollViewer x:Name="PART_ContentHost"
												FontSize="{TemplateBinding FontSize}"
												VerticalAlignment="Center"
												SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
					</Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Validation.HasError" Value="true">
                            <Setter Property="ToolTip"
                                    Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                                    Path=(Validation.Errors)[0].ErrorContent}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel LastChildFill="True">
                        <TextBlock DockPanel.Dock="Bottom" Foreground="Red"
                                   FontWeight="Bold" FontSize="14">!</TextBlock>
                        <Border BorderBrush="Red" BorderThickness="1">
                            <AdornedElementPlaceholder/>
                        </Border>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>